package inl.resilienceManager.qmul.gemom;



import javax.swing.JFrame;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JPanel;

import mo.qmul.gemom.publisher;

import resilienceManager.qmul.gemom.ScenarioManager;
import cbr.resilienceManager.qmul.gemom.CbrResilienceManager;

import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import java.awt.Insets;
import java.awt.Dimension;
import java.awt.Toolkit;

/** COPYRIGHT DISCLAIMER
 * Synopsis: All the source codes presented in this document are intellectual
 * properties of Queen Mary, University of London.
 * 
 * @year 2010
 * @author Peng Jiang, John Bigham, Jiayi Wu Jinfu Wang------------QMUL
 * @version 1.0 
 * */

public class MainControlFrame extends JFrame {

	private static final long serialVersionUID = 1L;
	private JButton jButton_ini = null;
	private JPanel jPanel_button = null;
	private JButton jButton_failure = null;



	/**
	 * This method initializes jButton_ini	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton_ini() {
		if (jButton_ini == null) {
			jButton_ini = new JButton();
			jButton_ini.setText("Analysis");
			jButton_ini.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					
					iniFrame iframe= new iniFrame();
					
					iframe.show();
				}
			});
		}
		return jButton_ini;
	}

	/**
	 * This method initializes jPanel_button	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel_button() {
		if (jPanel_button == null) {
			GridLayout gridLayout1 = new GridLayout();
			gridLayout1.setRows(1);
			jPanel_button = new JPanel();
			jPanel_button.setLayout(gridLayout1);
			jPanel_button.add(getJButton_ini(), null);
			jPanel_button.add(getJButton_failure(), null);
		}
		return jPanel_button;
	}

	/**
	 * This method initializes jButton_failure	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton_failure() {
		if (jButton_failure == null) {
			jButton_failure = new JButton();
			jButton_failure.setText("Online Response");
			jButton_failure.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					
					//ScenarioManager sm= new ScenarioManager();
					//sm.ConAction();
//					//sm.show();
					
					CbrResilienceManager cbrResilience = new CbrResilienceManager();
					
					cbrResilience.setVisible(true);
					cbrResilience.validate();
				}
			});
		}
		return jButton_failure;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		SplashScreen wScreen= new SplashScreen(1600);
		
		
		MainControlFrame mFrame= new MainControlFrame();
		
		mFrame.setVisible(true);

	}

	/**
	 * This is the default constructor
	 */
	public MainControlFrame() {
		super();
		initialize();
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		GridLayout gridLayout = new GridLayout(1,2);
		this.setLayout(gridLayout);
		this.setTitle("Resilience Manager");

		this.setContentPane(getJPanel_button());
		this.setSize(406, 67);
		
		Dimension scr = Toolkit.getDefaultToolkit().getScreenSize(); 
		Dimension frm = this.getSize(); 
		setLocation( (scr.width - frm.width) / 2, 
				(scr.height - frm.height)/6); 
		

	}

}  //  @jve:decl-index=0:visual-constraint="266,6"
